﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016082700321331";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCoe7vocS9xjXdDAB9qjL+FPqjCN3UWotvslGEnkIajaw1jKH7TlBNK1AO1avbJtuE881yfW4OnjuGW1OMvlMXOmFEn2RpOwBcg9lthm/AIUXvntn9u6JpufbXj7h+MMWDWmLpWh3RoJLQufMbi9s4qlTyNxqKJa4AZauAyldneX73RaJOF+TDtvU+Rw5e/UfCe+heZw+RaUVtUgh2zuFZ4rwWgik9+4ivi+4rwvnKsOgZfN6FO79Z+TBk2Re2UDiVBSPzhsG0iPkYdgWSjCLwugI58A5a9BD+82J4sIZC8ZfD1aH3j4ZQOgF5KJ/HwnkVmNdymbXAQmzyZBvPxH4n7AgMBAAECggEAWRGAlzMu16Lnx33LHfLmVLR5VqMmvR6/kOQoMFhRNRck7qS713JSeJ54j3HKoXySujwVXRFuGiiIzcohiEfoAn23eY9mPveBwqU6TfG4BU2+aRKrb6B786l1fNenyd9YyFnZOGFHgr7UmjbQla/P8ecPKgw2ZNt1zvoXJ+bcVJf94TLTHL1fJlFPM6jJEK6aO46cdYnZQDUEI4yANCHNutCGhMdFBO4z7Dsd48LEg6mgnoRy1JorOnowPeX968DzDnUiR+UjZWbDtJK0p8heTYwOnodcJ9F8r7zJvGeLE7B276vYwWd6qzVW/MqKz4vQeK9IBi9AYZT1JfyPQmi1oQKBgQD2UsZ7V2KBkSCVtYiZ1KxjVRSFoARJzzQ2q6NSXKUWV08P2OH4vqxDYNNZsj5N4+yXFWM8cF7l/MOLKCkyn/zwXP9hZenMqBhFmDKX4lxHzey/xp8fA+zW5J9U8LX2/yTxd17bpg7VaPwjFX6IsJIgP53HtwwXk6kW8XZ+3ZsJEwKBgQCvGiMmF2It8B+LdwA+aXHaABL/b3fSJxvepuKjb0vdv5Yvhdo+7Vk06F54oWAlrkM0y7xLvSzZW9qNjVHjY1McVcRGQD1MvaN5ZS1kchOTPAOLAYs5tKVZUZH1TH6I+MxKjIs76LrCaO0u9/E4d5u2siyrdBAXgLvkOaW6fw7AeQKBgGNGNyJMtLG9eOF9eWFuOlAKYSv9stzAeq2x/S/bkNlxNLcRVPl4d1rsciHLWZrwylCV2RnpvAV7GqBB/mCd5EZHZNGvTkwiTy31Sia2nzR9RPaBqW3JmjF9kM2d+ehjKlN7JarmwUG3fy7wob+bUjlXClMMbf4uj85kYLp+u9YrAoGBAITvh/3UROJxadF87/9yGFCUO9gXbVVsAZmhA3Fm/qcEW+YKbe3WTiJ/w7E7ev5AdZ9wiazKm3ENbjiHMMM8Vg2uA4v+G0vWsXRpXvPiM4BVUK9I5cVSozHTXsdnYq1kjdyPJOm/v4H3HRLKhCUFkX87d/RW8hyVzI/xQCP9cFqpAoGBAJm7kWksZ0+rac8YkbeT2DC5AtBy42zckvbIwjvCiv+zumjmkdYwWikelWyafCZkMrYcPKt39PA4uDqv062yvOfri7azdjuNxHhy879LsSzoxFr5VfxVL6/X5r04Swn7Vp9YfVfN6L2yuqaqNrOvRMK0tM9HXcDjg8gFHBPvhy+4";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqHu76HEvcY13QwAfaoy/hT6owjd1FqLb7JRhJ5CGo2sNYyh+05QTStQDtWr2ybbhPPNcn1uDp47hltTjL5TFzphRJ9kaTsAXIPZbYZvwCFF757Z/buiabn214+4fjDFg1pi6Vod0aCS0LnzG4vbOKpU8jcaiiWuAGWrgMpXZ3l+90WiThfkw7b1PkcOXv1HwnvoXmcPkWlFbVIIds7hWeK8FoIpPfuIr4vuK8L5yrDoGXzehTu/WfkwZNkXtlA4lQUj84bBtIj5GHYFkowi8LoCOfAOWvQQ/vNieLCGQvGXw9Wh94+GUDoBeSifx8J5FZjXcpm1wEJs8mQbz8R+J+wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/dzms-webs/homepage";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

